package view.menu;

import java.awt.Cursor;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import view.Menu;
import view.generaldesign.DesignLayout;

/**
 *
 * @author Sonny Sandberg
 */
public abstract class MenuLabel extends JLabel
{
    private view.Menu menuItem;
    private String menuLabelText;

    public MenuLabel(String text, view.Menu menu)
    {
        super(text);
        menuLabelText = text;
        this.menuItem = menu;
        
        setFocusable(false);
        setBorder(null);
        setOpaque(false);
        setFont(new Font("Lucida Sans Unicode", Font.PLAIN, 15));
        
        MouseAdapter 
                    mouseEntered,
                    mouseExited;
        
        mouseEntered =
                (
                    new MouseAdapter()
                    {
                        public void mouseEntered(MouseEvent evt)
                        {
                            setCursor(new Cursor(Cursor.HAND_CURSOR));
                        }
                    }
                );
        
        mouseExited =
                (
                    new MouseAdapter()
                    {
                        public void mouseExited(MouseEvent evt)
                        {
                            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                        }
                    }
                );
        
        this.addMouseListener(mouseEntered);
        this.addMouseListener(mouseExited);
    }
    
    public String getMenuLabelText()
    {
        return menuLabelText;
    }
    
    public void setBackgroundColor()
    {
        setBackground(DesignLayout.MENU_TOP_BG_CHOSEN_RED);
        setOpaque(true);
    }

    public Menu getMenuItem()
    {
        return menuItem;
    }
}
